#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>

/*
  *	test wmqviviq 25 125
  */
typedef  struct student {
	char name[64];
	unsigned int age;
	unsigned int code;
}STU,*STU_Tb;


int main(int argc, char ** argv)
{
	int fd;
	int val;
	STU stu1;
	
	fd = open("/dev/fifo",O_RDWR);
	if (fd < 0)
	{
		printf("can't open !\n");
	}
	if (strstr(argv[1],"-h"))
	{
		printf("Usage :\n");
		printf("%s name age code\n", argv[0]);
		return 0;
	}

	if(argc <2)
		strcpy(stu1.name,"");
	else
		strcpy(stu1.name,argv[1]);
	if(argc <3)
		stu1.age = 0;
	else
		stu1.age = atoi(argv[2]);
	if(argc <4)
		stu1.code = 0;
	else
		stu1.code = atoi(argv[3]);

	val = (int)&stu1;
	write(fd, &val, 4);
	close(fd);
	
	return 0;
}

